<?php

class library_Controller extends Template_Controller {



	public $template = 'client/index';

	public $language = '';

    public function __construct()

    {

        parent::__construct();

        

        //Css

        //$this->template->css = $this->site['theme_url'].'article/article.css';

       	$this->language = $this->get_client_lang();

    }

    

	public function __call($method, $arguments)

	{

		// Disable auto-rendering

		$this->auto_render = FALSE;

	}

	

    public function index()

    {	

		$this->page();

		

    }

    public function page()

    {

    	$language= $this->get_client_lang();

		$this->template->content = new View('library/index');

		$model = new Programs_Model(); 

		$this->db->limit(10,0);	

		$mPrograms = $model->get_with_active($this->language);

		$this->template->content->mPrograms= $mPrograms;

		//solutoin

		$model = new Solutions_Model(); 

		$this->db->limit(10,0);	

		$mSolutions = $model->get_with_active($this->language);

		$this->template->content->mSolutions= $mSolutions;

		//coaching

		$model = new Coaching_Model(); 

		$this->db->limit(10,0);	

		$mCoaching = $model->get_with_active($this->language);

		$this->template->content->mCoaching= $mCoaching;

		

    }

    public function programs($id)

    {

    	$this->template->content = new View('library/programs');

    	$language = $this->get_client_lang();

		$model = new Programs_Model(); 

		$this->db->where('programs_content.programs_id',$id);

		$mlist = $model->get_with_active($language);

    	$this->template->content->mr = $mlist[0];
		$mlistOther = $this->other_programs($id);
		//print_r($mlistOther);
		$this->template->content->mlistOther = $mlistOther;

    }

	

	 public function solutions($id)

    {

    	$this->template->content = new View('library/solutions');

    	$language = $this->get_client_lang();

		$model = new Solutions_Model(); 

		$this->db->where('solutions_content.solutions_id',$id);

		$mlist = $model->get_with_active($language);

    	$this->template->content->mr = $mlist[0];
		
		$mlistOther = $this->other_solution($id);
		//print_r($mlistOther);
		$this->template->content->mlistOther = $mlistOther;

    }

	 public function coaching($id)

    {

    	$this->template->content = new View('library/coaching');

    	$language = $this->get_client_lang();

		$model = new Coaching_Model(); 

		$this->db->where('coaching_content.coaching_id',$id);

		$mlist = $model->get_with_active($language);

    	$this->template->content->mr = $mlist[0];
		
		$mlistOther = $this->other_coaching($id);
		//print_r($mlistOther);
		$this->template->content->mlistOther = $mlistOther;

    }
	public function other_programs($id)

    {

    	$language = $this->get_client_lang();

		$model = new Programs_Model(); 

		$this->db->where('programs.programs_id <>',$id);

		$mlist = $model->get_with_active($language);

    	return $mlist;

    }
	public function other_solution($id)

    {

    	$language = $this->get_client_lang();

		$model = new Solutions_Model(); 

		$this->db->where('solutions.solutions_id <>',$id);

		$mlist = $model->get_with_active($language);

    	return $mlist;

    }
	public function other_coaching($id)

    {

    	$language = $this->get_client_lang();

		$model = new Coaching_Model(); 

		$this->db->where('coaching.coaching_id <>',$id);

		$mlist = $model->get_with_active($language);

    	return $mlist;

    }

}

?>